Topic 1 Question #5
You manage a Cloud Storage bucket that stores temporary files created during data processing. These temporary files are only needed for seven days, after which they are no longer needed. To reduce storage costs and keep your bucket organized, you want to automatically delete these files once they are older than seven days. What should you do?
- A.
Set up a Cloud Scheduler job that invokes a weekly Cloud Run function to delete files older than seven days.
- B.
Configure a Cloud Storage lifecycle rule that automatically deletes objects older than seven days.
- C.
Develop a batch process using Dataflow that runs weekly and deletes files based on their age.
- D.
Create a Cloud Run function that runs daily and deletes files older than seven days.
Answer: B
The scenario requires automatic deletion of Cloud Storage objects 7 days after creation to reduce storage costs and keep the bucket organized, with minimal operational overhead. The suggested answer B leverages the native Cloud Storage lifecycle rule feature, which is a purpose-built, fully managed capability designed explicitly for this use case. For associate data practitioners, a core competency is selecting the most efficient, low-overhead native service to address common data operational tasks, rather than building custom solutions that add unnecessary complexity and cost. This approach requires no custom code, no management of additional services, and enforces the deletion rule consistently at the storage layer, ensuring compliance with the 7-day retention requirement without manual intervention. Option Analysis:
A. Incorrect. This solution requires provisioning and managing two separate GCP services (Cloud Scheduler and Cloud Run) plus writing, testing, and maintaining custom code to enumerate and delete old objects. It introduces unnecessary operational overhead, and running weekly means objects may remain in storage for up to 14 days, failing to consistently enforce the 7-day retention requirement. It is far less efficient than the native lifecycle rule feature.
B. Correct. Cloud Storage lifecycle rules are a fully managed, native feature built directly into the Cloud Storage service to automate object management actions. Configuring a rule to delete objects older than 7 days requires no custom code, no additional service management, and runs automatically to delete objects promptly once they meet the age threshold. It perfectly aligns with the requirement to reduce cost and organize the bucket with minimal effort, which is a standard best practice for data practitioners working with cloud object storage.
C. Incorrect. Dataflow is a managed service designed for large-scale batch and stream data processing workloads such as ETL, data transformation, and analytics processing. Using Dataflow for simple object deletion is a significant misalignment of service purpose, introducing excessive cost, operational complexity, and resource overhead for a task that is handled natively by Cloud Storage at no additional cost.
D. Incorrect. While running daily is more frequent than the weekly cadence in option A, this solution still requires writing and maintaining custom Cloud Run function code, handling edge cases such as large volumes of objects that may cause function timeouts, and managing invocation permissions. It introduces avoidable operational risk and overhead compared to the native, no-code lifecycle rule feature. Key Concepts:
1. Cloud Storage Lifecycle Management: This is a core native Cloud Storage capability that allows users to define automated actions for objects based on predefined conditions such as object age, version count, or storage class duration. It eliminates the need for custom operational scripts for standard object management tasks.
2. Cloud Cost and Operational Efficiency for Data Practitioners: Associate data practitioners are expected to prioritize purpose-built, low-overhead native cloud services over custom developed solutions for common use cases, to reduce operational burden, minimize error risk, and optimize storage and compute costs.
3. Service Use Case Alignment: A core certification competency is matching workload requirements to the appropriate GCP service, avoiding overprovisioning of general-purpose compute or processing services for tasks that are handled by specialized, lower-cost native features. References:
Object Lifecycle Management | Cloud Storage, Google Cloud,
https://cloud.google.com/storage/docs/lifecycle
Google Cloud Associate Data Practitioner Exam Guide